package hibernate.administratorAccount;

import java.util.HashSet;
import java.util.Set;

public class LicenceGenerator {
	private static final Licence MANAGER = new Licence();
	private static final Licence ACCOUNTANT = new Licence();
	private static final Licence SOFTWAREENGINEER = new Licence();
	private static final Licence FRONTDESK = new Licence();
	
	private static final String[] COMMONCMD = { "更换登陆帐号", "暂时离开", "修改登陆密码", "首选项", "计算器", 
												"操作向导", "退出" };
	private static final String[] MANAGERCMD = { "注册新用户", "协议单位管理", "协议房价" };
	private static final String[] ACCOUNTANTCMD = { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" };
	private static final String[] SOFTWAREENGINEERCMD = { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" };
	private static final String[] FRONTDESKCMD = { "房态中心", "财务催缴", "预订管理", "合并账单", "拆分帐单", "门锁发卡", "客务中心", "未结帐客人", "已结帐客人", "修改房态", "维修房登记与查询", "自用房登记与查询",
		                                           "", "", "", "", "", "", "", "", "", "" };
	
	static{
		int count;
		
		Set manager = new HashSet();
		Set accountant = new HashSet();
		Set softwareEngineer = new HashSet();
		Set frontDesk = new HashSet();
		
		for( count = 0; count < COMMONCMD.length; count++ ){
			manager.add( COMMONCMD[ count ] );
			accountant.add( COMMONCMD[ count ] );
			softwareEngineer.add( COMMONCMD[ count ] );
			softwareEngineer.add( COMMONCMD[ count ] );
		}
		
		for( count = 0; count < MANAGERCMD.length; count++ ){
			manager.add( MANAGERCMD[ count ] );
		}
		
		MANAGER.setAppLicenceMapping( manager );
		
		for( count = 0; count < ACCOUNTANTCMD.length; count++ ){
			accountant.add( ACCOUNTANTCMD[ count ] );
		}
		
		ACCOUNTANT.setAppLicenceMapping( accountant );
		
		for( count = 0; count < SOFTWAREENGINEERCMD.length; count++ ){
			softwareEngineer.add( SOFTWAREENGINEERCMD[ count ] );
		}
		
		SOFTWAREENGINEER.setAppLicenceMapping( softwareEngineer );
		
		for( count = 0; count < FRONTDESKCMD.length; count++ ){
			frontDesk.add( FRONTDESKCMD[ count ] );
		}
		
		FRONTDESK.setAppLicenceMapping( frontDesk );
	}

	public static Licence getLicence(int position) {
		// TODO Auto-generated method stub

		switch( position ){
			case 0:
				return MANAGER;
			case 1:
				return ACCOUNTANT;
			case 2:
				return SOFTWAREENGINEER;
			case 3:
				return FRONTDESK;
			default:
				return null;
		}
	}
}
